Skip to content

feat(django): Add failed_request_status_codes - #7140

Open
mgaligniana wants to merge 1 commit into
getsentry:masterfrom
mgaligniana:GH-3134-add-failed-request-status-code-for-django
Open

feat(django): Add failed_request_status_codes#7140
mgaligniana wants to merge 1 commit into
getsentry:masterfrom
mgaligniana:GH-3134-add-failed-request-status-code-for-django

Conversation

@mgaligniana

@mgaligniana mgaligniana commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Hi! In this PR I've added failed_request_status_code to the Django integration

  • I used AI and reviewed the changes.

Since English isn't my first language, I tried to keep the comments as simple and clear as possible, so they're easy to understand even for beginners like me who don't know the full Sentry product. Feel free to make any changes or suggestions!

Issues

@mgaligniana
mgaligniana requested a review from a team as a code owner August 10, 2026 00:27

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR @mgaligniana , we really appreciate you taking the time to do so!

Overall the changes are looking great. However, I don't think we can exclude the 5xx codes from the failed_request_status_codes (left a more detailed comment below) and we'll need to address that before we can merge.

Don't hesitate to reach out with any questions!



def _capture_exception(
exc_info: "Any",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can tighten this typing a bit by copying what we do within the event_from_exception method that's being invoked within this function:

Suggested change
exc_info: "Any",
exc_info: "Union[BaseException, ExcInfo]",

This requires updating the import from sentry_sdk._types at the top to import ExcInfo:

    from sentry_sdk._types import (
        Event,
        EventProcessor,
        ExcInfo,
        Hint,
        NotImplementedType,
    )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread tests/integrations/django/test_basic.py
@mgaligniana
mgaligniana force-pushed the GH-3134-add-failed-request-status-code-for-django branch from 44db0ad to 805023b Compare August 12, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants